<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>

    </h:head>
    <h:body>
        <h:form id="formSalvar">
            <p:panel  header="Cadastro dos tipos de atividades complementares"> 
                <p:messages id="msgs"/> 
                <h:panelGrid >

                    
                    Tipo de atividade: *<p:inputText  value="#{controllerAtvCompTipo.atvCompTipo.tipo_atividade}" maxlength="20"/>
                    
                    <p:commandButton value="Salvar" actionListener="#{controllerAtvCompTipo.salvar()}" ajax="true" update="@form"/>
                    
                    <p:ajaxStatus style="position:fixed;right:20px;top:20px">  
                        <f:facet name="start">
                            <h:graphicImage value="../resources/images/ajax-loader.gif" />
                        </f:facet>
                        <f:facet name="complete">
                            <h:outputText value="" />
                        </f:facet>
                    </p:ajaxStatus>

                </h:panelGrid>
            </p:panel>
            
            <p:dataTable id="tabela" var="p" value="#{controllerAtvCompTipo.listaDM}" emptyMessage="Nada encontrado...">
                <p:column>
                    <h:outputText value="#{p.tipo_atividade}"/>
                </p:column>
                <p:column>
                    <p:commandLink value="alterar" actionListener="#{controllerAtvCompTipo.prepararAlterar()}" ajax="true" oncomplete="dialogAlterar.show();" update=":formAlterar"/>
                </p:column>
                <p:column>
                    <p:commandLink value="apagar" actionListener="#{controllerAtvCompTipo.remover()}" ajax="true" process="@this" update="@form"/>
                </p:column>
            </p:dataTable>
  
        </h:form>
        
        
        <p:dialog widgetVar="dialogAlterar" resizable="false" closable="false" modal="true" showEffect="slide" hideEffect="slide">
            <h:form id="formAlterar">
                <p:panel>
                    <p:messages id="msgs"/> 
                    <h:panelGrid columns="2">
                        Tipo de atividade: *
                            <p:inputText value="#{controllerAtvCompTipo.atvCompTipo.tipo_atividade}"/>
                            <p:commandButton value="Alterar" actionListener="#{controllerAtvCompTipo.alterar()}" oncomplete="dialogAlterar.hide()" update=":formSalvar" 
                                             style="margin-top: 30px"/>
                            <p:commandButton value="cancelar" actionListener="#{controllerAtvCompTipo.limpar()}" oncomplete="dialogAlterar.hide()" update=":formSalvar" 
                                             style="margin-top: 30px;margin-left: -50px;"/>
                    </h:panelGrid>
                </p:panel>
            </h:form>
        </p:dialog>
        
    </h:body> 
</html>
